using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Ent.Voice.Nomination;
using Ent.Voice.Show;
using Ent.Web.WebControl;
using Ent.Web.Helper;

public partial class Member_Home : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlLink css = new HtmlLink();
        css.Href = ConfigurationManager.AppSettings["BaseUrl"] + "/styles/dj/home.css";
        css.Attributes["rel"] = "stylesheet";
        css.Attributes["type"] = "text/css";
        Page.Header.Controls.Add(css);

        if (Session["USERID"] != null)
        {
            int total = 0;
            lblEntryHeaderTitle.Text = Common.GetImageTextLink("member/myentry.aspx", "Images/dj/entry.gif", ResourceHelper.Get("LBL_MyNominations"), 15);
            Entry[] entries = Ent.Voice.User.GetEntriesWithinRange(Session["USERID"].ToString(), 1, 3, true, StringHelper.ConvertToString(Session["USERID"]), ref total, Entry.GetOrderBy(0));
            if (entries != null && entries.Length > 0)
            {
                TableCell tc = new TableCell();
                TableRow tr = new TableRow();
                Page p = (Page)this;
                for (int i = 0; i < entries.Length; i++)
                {
                    DashEntry de = (DashEntry)Common.CreateDashEntry(ref p, (Entry)entries.GetValue(i), EntryMode.HomePage);
                    tc = new TableCell();
                    tc.Controls.Add(de);
                    tc.VerticalAlign = VerticalAlign.Top;
                    tc.Height = Unit.Percentage(100);
                    tr.Cells.Add(tc);
                    tblEntries.Rows.Add(tr);
                    tr = new TableRow();
                }
                lnkEntryMore.Text = ResourceHelper.Get("LBL_More");
                lnkEntryMore.NavigateUrl = ConfigurationManager.AppSettings["BaseUrl"] + "/member/myentry.aspx";
                lblMyNominations.Visible = false;
            }
            else
            {
                lblMyNominations.Text = Common.GetAlertText(ResourceHelper.Get("MSG_NoNominationSubmitted"));
                tblEntries.Visible = false;
            }

            lblEventHeaderTitle.Text = Common.GetImageTextLink("member/myevent.aspx", "Images/dj/event.gif", ResourceHelper.Get("LBL_MyEvents"), 15);
            Event[] evs = Event.GetUserEvents(Session["USERID"].ToString(), 3);
            if (evs != null && evs.Length != 0)
            {
                lblMyEvent.Text = Common.SerializeForUpdate(evs, "list_subheader");

                lnkEventMore.Text = ResourceHelper.Get("LBL_More");
                lnkEventMore.NavigateUrl = ConfigurationManager.AppSettings["BaseUrl"] + "/member/myevent.aspx";
            }
            else
                lblMyEvent.Text = Common.GetAlertText(ResourceHelper.Get("MSG_NoEventCreated") + "<br/><a style=\"float:right;\" href=\"" + ConfigurationManager.AppSettings["BaseUrl"] + "/CreateShow.aspx?mode=1" + "\">" + ResourceHelper.Get("MSG_HostEvent") + "</a>");
        }
    }
}
